home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17862 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  64 lines

  1. Newsgroups: comp.lang.c++
  2. Path: undergrad.math.uwaterloo.ca!clgonsal
  3. From: clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves)
  4. Subject: Re: Would/Won't you use a garbage collector?
  5. Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
  6. Message-ID: <Dq0p81.F38@undergrad.math.uwaterloo.ca>
  7. Date: Wed, 17 Apr 1996 17:43:13 GMT
  8. References: <4kamie$e4d@dfw-ixnews3.ix.netcom.com> <4kjbeq$36u@preeda.internex.net.au> <4km6vv$hjt@dfw-ixnews4.ix.netcom.com>
  9. Nntp-Posting-Host: lhopital.uwaterloo.ca
  10. Organization: University of Waterloo
  11.  
  12. In article <4km6vv$hjt@dfw-ixnews4.ix.netcom.com>,
  13. Giuliano Carlini <giuliano@ix.netcom.com> wrote:
  14. >In <4kjbeq$36u@preeda.internex.net.au> sultan@connexus.apana.org.au
  15. >(Jon Hornstein) writes: 
  16. >
  17. >>Please mail to me where I can get GC packages. Thanks in advance!
  18. >>
  19. >A freeware library is available from parcftp.xerox.com/pub/gc.
  20. >A commercial library is available from geodesic systems:
  21. >www.geodesic.com
  22. >
  23. >DISCLOSURE: I'm associated with geodesic systems, and hope to profit
  24. >from licensing fees/royalties from them.
  25.  
  26. Looking at Great Circle's technology overview (at www.geodesic.com) I see
  27. that there are two ways of using Great Circle. 
  28.  
  29. The "GCTransparent" way only requires that you link with a special library.
  30. It looks like Great Circle scans the stack, the registers, and the static
  31. data area looking for pointers to data on the heap. Of course, at run time
  32. there's no way to tell what's a pointer and what's not, so it just assumes
  33. that every word is a pointer. This is confirmed by the statement:
  34.  
  35. "Since all data is examined, even difficult cases like unions and the
  36. storing of pointers in integers are automatically handled."
  37.  
  38. This seems like a classic example of making a bug look like a feature. I
  39. may have code that hold a bunch of random integers. The chance that some of
  40. these random integers just happen to look like pointers to something on the
  41. heap is pretty high. This means Great Circle is going to "leak" any objects
  42. that seem to have pointers pointing at them. In fact, the bigger an object
  43. is, the greater the chance that it will be leaked, since Great Circle looks
  44. for pointers pointing anywhere within the object.
  45.  
  46. The other way of using Great Circle ("GCPointers") uses some form of
  47. garbage collecting smart pointers. I have to wonder how well this works
  48. with other libraries though. I could imagine a template in a library
  49. creating "plain" pointers to an object the collector knows about. If the
  50. only pointers to a collectable object are "plain" pointers, then the
  51. collector won't know that the object is being pointed at, and it will
  52. delete it.
  53.  
  54. Even so, the GCPointers idea seems less disagreeable than the leaky
  55. alternative. I'd really like to know how it could work with third-party
  56. libraries though.  Would it be possible to use STL containers, for
  57. example, with GCPointers?
  58.  
  59. -- 
  60.         Carl Laurence Gonsalves - clgonsal@undergrad.math.uwaterloo.ca
  61.                    Computer Science, University of Waterloo
  62.                http://www.undergrad.math.uwaterloo.ca/~clgonsal/
  63.                    http://www.csclub.uwaterloo.ca/~clgonsal/
  64.